addon-unit: dotted-path invocation + scheduled runs - #3
Merged
Conversation
The prior runner ran ``xmlrunner discover`` from inside each addon's tests/ dir. That invocation hides Python namespace-package traps: the addon directory never enters sys.modules as a package, so ``from <Addon> import <Addon>`` in a test body resolves to the class rather than the same-named submodule. When a contributor (or addons-source's own ci.yml) runs the tests by dotted path, the trap surfaces as AttributeError on a class attribute — exactly the bug 0012691 failure Gary hit on PR #824. Changes: - scripts/ubuntu/run-addon-unit.sh: collect ``<Addon>.tests.<module>`` paths per addon and invoke ``python -m xmlrunner <mods>`` from addons-source/, matching the upstream ci.yml shape. - .github/workflows/addon-unit-tests.yml: add push/PR/schedule (06:30 UTC, slotted after docker-build's 06:00), switch to the same dotted-path invocation, and mark the job continue-on-error in line with unit-tests.yml. - CLAUDE.md: document the pre-push ``run-addon-unit.sh <Addon>`` convention, explain why dotted-path loading catches namespace-package bugs, and refresh Status + cron list.
TMGimporter/libtmg.py imports the dbf PyPI package under a try/except that only logs a warning on ImportError. When dbf is missing, the import silently no-ops and later calls to Table(...) fail with NameError — which is exactly how TMGimporter/tests/test_integration.py's setUpClass was crashing in addon-unit runs (reported as _ErrorHolder in the JUnit output). Add dbf>=0.99.0 to both the local Dockerfile.ubuntu and the CI requirements-test.txt so the dependency is present in every environment where addon tests run. Local TMGimporter run now reports 175/175 OK (was 157 pass + 1 setUpClass error).
Each addon declares its Python deps via requires_mod=[...] in its .gpr.py, and Gramps' Addon Manager pip-installs exactly that list when a user clicks Install (gramps/gui/plug/_windows.py __on_install_clicked → requirements.install → gen/utils/requirements.py). Mirror that behaviour in the testbed so the test environment matches what an end-user gets, and so new addon deps are picked up automatically without a parallel list to maintain. - scripts/ubuntu/run-addon-unit.sh: scan /workspace/addons-source/*/*.gpr.py for requires_mod declarations, union, pip-install each package individually (so a single build failure — pygraphviz without graphviz-dev, psycopg2 without libpq-dev — does not abort the batch). - .github/workflows/addon-unit-tests.yml: same derivation step, running against the PR/fork checkout. - docker/Dockerfile.ubuntu + requirements-test.txt: drop the hand-rolled `dbf` entry; it's now covered by the auto-derive, and keeping it would create a parallel source of truth that drifts. Verified locally: union of 9 deps discovered across 8 addons (boto3, dbf, life_line_chart, litellm, networkx, psycopg, psycopg2, pygraphviz, svgwrite). 7 install cleanly; psycopg2 and pygraphviz fail on missing system headers (known; affected addons' tests fail in isolation). TMGimporter: 175/175 OK purely via auto-derived dbf.
eduralph
added a commit
that referenced
this pull request
May 12, 2026
- Remove .claude/scheduled_tasks.lock from version control. The file is a runtime lock created by the schedule skill and shouldn't have been committed in #3 (bf1a721). - Add commonly used read-only Bash patterns to .claude/settings.json allow list (python3:*, python:*, cd *, PYTHONPYCACHEPREFIX=*:*, PYTHONPATH=*:*, pip show:*, pip list:*) to cut down on permission prompts during routine development. - Gitignore fetch_comments.py — a scratch helper used during one-off PR-feedback sweeps that occasionally lands in the workspace root. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/ubuntu/run-addon-unit.sh) and testbed CI (.github/workflows/addon-unit-tests.yml) now load each addon test via its dotted path (<Addon>.tests.<module>) fromaddons-source/, matchingaddons-source/.github/workflows/ci.yml. Catches namespace-package traps thatdiscover-from-tests/hides (PR #824 / bug 0012691).addon-unit-tests.ymlgains push/PR/nightly (06:30 UTC) triggers +continue-on-errorjob-level, so regressions surface in the testbed without blocking merges (matches unit-tests.yml gate policy)../scripts/ubuntu/run-addon-unit.sh <Addon>convention and the reason it catches namespace-package bugs.Test plan
./scripts/ubuntu/run-addon-unit.sh DataEntryGrampletpasses against the fixed PR #824 branch (6/6 tests)../scripts/ubuntu/run-addon-unit.sh TMGimporterstill runs 157 tests (pre-existing integration error unchanged).from models import …failure under hardened runner matches its failure under the previousdiscoverinvocation — no regression introduced.